package com.lidx.back.statistics.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lidx.back.statistics.dao.IDictionaryDao;
import com.lidx.back.statistics.dao.IMaterialCategoryDao;
import com.lidx.back.statistics.entity.ClientInfo;
import com.lidx.back.statistics.entity.MaterialCategory;
import com.lidx.back.statistics.service.IAppInitService;
import com.lidx.back.statistics.service.IMaterialCategoryService;
@Service
public class MaterialCategoryServiceImpl implements IMaterialCategoryService {

	@Autowired
	private IMaterialCategoryDao categoryDao;
	@Autowired
	private IAppInitService appInitService;
	@Autowired
	private IDictionaryDao dictionaryDao;
	
	public void saveMaterialCategory(MaterialCategory category) throws Exception {
		categoryDao.insertMaterialCategory(category);
	}

	public List<MaterialCategory> getCategories(String deviceId) {
		//ClientInfo info = appInitService.getClientInfoByDeviceId(deviceId);
		String sex = appInitService.getClientSexInfoByDeviceId(deviceId);
		return categoryDao.findCategories(sex);
	}

}
